package com.x.erp.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.MultilevelActivityDetailDao;
import com.x.erp.model.MultilevelActivityDetail;
import com.x.erp.rpc.MultilevelActivityDetailRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 多级营销活动账户明细记录服务
 */
@Component
@Service(interfaceName = "com.x.erp.rpc.MultilevelActivityDetailRpcService", timeout = 60000)
public class MultilevelActivityDetailService extends BaseService implements MultilevelActivityDetailRpcService {

	@Autowired
	private MultilevelActivityDetailDao multilevelActivityDetailDao;//多级营销活动账户明细记录信息DAO

//	@Autowired
//	private MultilevelActivityDetailManage multilevelActivityDetailManage;//多级营销活动账户明细记录信息Manage

	/**
	 * 查询多级营销活动账户明细记录列表
	 * @param multilevelActivityDetail
	 * @return
	 */
	@Override
	public List<MultilevelActivityDetail> selectMultilevelActivityDetailList(MultilevelActivityDetail multilevelActivityDetail){
		try {
			return multilevelActivityDetailDao.selectMultilevelActivityDetailList(multilevelActivityDetail);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 查询多级营销活动账户明细排行榜
	 * @param multilevelActivityDetail
	 * @return
	 */
	@Override
	public List<MultilevelActivityDetail> selectMultilevelActivityDetailTopList(MultilevelActivityDetail multilevelActivityDetail){
		try {
			return multilevelActivityDetailDao.selectMultilevelActivityDetailTopList(multilevelActivityDetail);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	@Override
	public int selectMultilevelActivityDetailNum(MultilevelActivityDetail multilevelActivityDetail) {
		return 0;
	}

	/**
	 * 新增多级营销活动账户明细记录信息
	 * @param multilevelActivityDetail
	 * @return
	 */
	@Override
	public MultilevelActivityDetail insertMultilevelActivityDetail(MultilevelActivityDetail multilevelActivityDetail){
		try {
			return null;
//			return multilevelActivityDetailManage.insertMultilevelActivityDetail(multilevelActivityDetail);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 修改多级营销活动账户明细记录信息
	 * @param multilevelActivityDetail
	 * @return
	 */
	@Override
	public int updateMultilevelActivityDetail(MultilevelActivityDetail multilevelActivityDetail){
		try {
			return this.update(multilevelActivityDetail);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	@Override
	public int deleteMultilevelActivityDetail(MultilevelActivityDetail multilevelActivityDetail) {
		try {
			return this.delete(multilevelActivityDetail);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
